/* **********************************************************/
/* Code to Replicate Results in 					        */
/* Strickland, James and Jesse Crosson	                    */
/* "K Street on Main:        								*/
/* Legislative Turnover and Multi-client Lobbying"	     	*/
/* In: Political Science Research and Methods				*/

*.do file for replicating regression results and figures presented in main text (Table 1 only) and appendix (most figures) using "K_Street_on_Main_dataset_50_states.dta"

*this program does not use absolute paths
*it assumes that upon starting Stata, the user sets working directory 

use K_Street_on_Main_dataset_50_states.dta, clear

*Model 1 in Table 1:

reg density00 wturnover legislators bowen000 foldedranney6yr initiativestate nosession definitions prohibitions reports defpro defrep firmreport noexpire employees, cluster(fips)

*Model 2 in Table 1: 

reg density00 wturnover2 legislators bowen000 foldedranney6yr initiativestate nosession definitions prohibitions reports defpro defrep firmreport noexpire employees, cluster(fips)

*Model 3 in Table 1:

reg density00 wturnover legislators bowen000 foldedranney6yr initiativestate nosession definitions prohibitions reports defpro defrep firmreport noexpire employees i.fips i.year

*Model 4 in Table 1:

reg density00 wturnover2 legislators bowen000 foldedranney6yr initiativestate nosession definitions prohibitions reports defpro defrep firmreport noexpire employees i.fips i.year

*For Figure A1 in appendix:

clear

use K_Street_on_Main_dataset_44_states.dta, clear

gen logl = log(lobbyists)
gen logc = log(clients)

xtset state year

xtline density , addplot(line logl logc year, yaxis(2))

graph export FigureA1.pdf

drop logl logc

*For FigureA2 in appendix:

clear

use K_Street_on_Main_dataset_6_states.dta, clear

gen logl = log(lobbyists)
gen logc = log(clients)

xtset state year

xtline density , addplot(line logl logc year, yaxis(2))

graph export FigureA2.pdf

drop logl logc

*For Figure A3 in appendix:

clear

use K_Street_on_Main_dataset_50_states.dta, clear

graph box density if density<=0.15 & fips!=4 & fips!=6 & fips!=26 & fips!=34 & fips!=36 & fips!=42, over(year)

graph export FigureA3.pdf

*For Figure A4 in appendix:

clear

use K_Street_on_Main_dataset_50_states.dta, clear

kdensity density

graph export FigureA4.pdf

*For Figure A5, see R file.

*For Figure A6:

clear

use K_Street_on_Main_dataset_50_states.dta, clear

xtline wturnover, addplot(line wturnover year, yaxis(2))

graph export FigureA6.pdf

*For Figure A7:

clear

use K_Street_on_Main_dataset_50_states.dta, clear

graph box wturnover, over(year)

graph export FigureA7.pdf

*For Figure A8:

clear

use K_Street_on_Main_dataset_50_states.dta, clear

hist wturndelta

graph export FigureA8.pdf

*For Table A1:

clear

use K_Street_on_Main_dataset_50_states.dta, clear

sum density00 if density00!=. & fips!=31, det
sum wturnover if density00!=. & fips!=31, det
sum legislators if density00!=. & fips!=31, det
sum bowen000 if density00!=. & fips!=31, det
sum foldedranney6yr if density00!=. & fips!=31, det
sum initiativestate if density00!=. & fips!=31, det
sum nosession if density00!=. & fips!=31, det
sum definitions if density00!=. & fips!=31, det
sum prohibitions if density00!=. & fips!=31, det
sum reports if density00!=. & fips!=31, det
sum firmreport if density00!=. & fips!=31, det
sum noexpire if density00!=. & fips!=31, det
sum employees if density00!=. & fips!=31, det

*For Table A2:

clear

use K_Street_on_Main_dataset_50_states.dta, clear

corr density00 wturnover legislators bowen000 folded initiativestate clients lobbyists dyads

*For models in Table A3:

clear

use K_Street_on_Main_dataset_50_states.dta, clear

*Model 1:

reg density00 wturnover legislators bowen000 foldedranney6yr initiativestate nosession definitions prohibitions reports defpro defrep firmreport noexpire employees clients000 lobbyists000, cluster(fips)

*Model 2: 

reg density00 wturnover2 legislators bowen000 foldedranney6yr initiativestate nosession definitions prohibitions reports defpro defrep firmreport noexpire employees clients000 lobbyists000, cluster(fips)

*Model 3:

reg density00 wturnover legislators bowen000 foldedranney6yr initiativestate nosession definitions prohibitions reports defpro defrep firmreport noexpire employees clients000 lobbyists000 i.fips i.year

*Model 4:

reg density00 wturnover2 legislators bowen000 foldedranney6yr initiativestate nosession definitions prohibitions reports defpro defrep firmreport noexpire employees clients000 lobbyists000 i.fips i.year

*For models in Table A4:

clear

use K_Street_on_Main_dataset_50_states.dta, clear

*Model 1:

reg density00 wturnover legislators bowen000 foldedranney6yr initiativestate nosession definitions prohibitions reports defpro defrep firmreport noexpire employees clients000 lobbyists000 dyads000, cluster(fips)

*Model 2: 

reg density00 wturnover2 legislators bowen000 foldedranney6yr initiativestate nosession definitions prohibitions reports defpro defrep firmreport noexpire employees clients000 lobbyists000 dyads000, cluster(fips)

*Model 3:

reg density00 wturnover legislators bowen000 foldedranney6yr initiativestate nosession definitions prohibitions reports defpro defrep firmreport noexpire employees clients000 lobbyists000 dyads000 i.fips i.year

*Model 4:

reg density00 wturnover2 legislators bowen000 foldedranney6yr initiativestate nosession definitions prohibitions reports defpro defrep firmreport noexpire employees clients000 lobbyists000 dyads000 i.fips i.year

*For remaining figures, see R file.
